
<div class="report_form">
	<?php echo $this->form;?>
	<script type="text/javascript" charset="utf-8">

$(document).ready(function(){
	 if($("select#agentReportForm").val() == null ){
	    $.getJSON("<?php echo $this->baseUrl(); ?>/admin/operatingreportbysalesman",{sid: $("select#salesmanReportForm").val(), ajax: 'true'}, function(j){
	      var options = '';
	      for (var i = 0; i < j.length; i++) {
	        options += '<option value="' + j[i].agent_id + '">' + j[i].agent_name + '</option>';
	      }
	      $("select#agentReportForm").html(options);
	    })
	 }
 })

$("select#salesmanReportForm").change(function(){
   $.getJSON("<?php echo $this->baseUrl(); ?>/admin/operatingreportbysalesman",{sid: $(this).val(), ajax: 'true'}, function(j){
      var options = '';
      for (var i = 0; i < j.length; i++) {
        options += '<option value="' + j[i].agent_id + '">' + j[i].agent_name + '</option>';
      }
      $("select#agentReportForm").html(options);
    })
})

</script>
</div>
<?php if (count($this->paginator)): ?>
<div class="list_report_summary">
<div class="list_report_total_trans">
	<div class="label"><?php echo $this->escape($this->translate("Total MO")) . ": ";?></div>
	<div class="value"><?php echo $this->total_mo;?></div>
</div>
<div class="list_report_total_trans">
	<div class="label"><?php echo $this->escape($this->translate("Total MT")) . ": ";?></div>
	<div class="value"><?php echo $this->total_mt;?></div>
</div>

<div class="list_report_total_trans">
	<div class="label"><?php echo $this->escape($this->translate("Total MP")) . ": ";?></div>
	<div class="value"><?php echo $this->total_mp;?></div>
</div>

<div class="list_report_total_amount">
	<div class="label">
		<?php echo $this->escape($this->translate("Total amount")) . ": ";?></div>
	<div class="value"><?php echo $this->total_amount;?></div>
</div>

</div>
<div class="list_reportfull_admin">
	<div class="list_report_title">
		<div class="ltc0_report"><?php echo $this->translate("Num"); ?></div>
		<div class="ltc3_report"><?php echo $this->translate("Day")?></div>
		<div class="ltc4_report"><?php echo $this->translate("Hour")?></div>
		<div class="ltc2_report"><?php echo $this->translate("Agent")?></div>
		<div class="ltc5_report"><?php echo $this->translate("Msisdn")?></div>
		<div class="ltc6_report"><?php echo $this->translate("Short code")?></div>
		<div class="ltc7_report"><?php echo $this->translate("Mo count")?></div>
		<div class="ltc8_report"><?php echo $this->translate("Mt count")?></div>
		<div class="ltc9_report"><?php echo $this->translate("Mp count")?></div>
		<div class="ltc10_report"><?php echo $this->translate("Money")?></div>
	</div>
	<?php $i = 0;foreach ($this->paginator as $item): ?>
	<?php
		$agent_url_array = array(
			'controller' => 'admin',
			'action' => 'operatingreportbysalesman',
			'agentReportForm' => $item["agent_id"],
			'page' => 1
		);

		foreach($this->params as $key => $value){
			if(!array_key_exists($key, $agent_url_array)){
				$agent_url_array[$key] = $value;
				$salesman_url_array[$key] = $value;
			}
		}

		$agent_link = $this->url($agent_url_array);
	?>
	<?php if($i++ % 2):?>
	<div class="list_report_data_odd">
	<?php else:?>
	<div class="list_report_data_even">
	<?php endif;?>
		<div class="ldc0_report"><?php echo $this->escape($i + ($this->page -1)* $this->itemsPerPage);?></div>
		<div class="ldc3_report"><?php echo $this->escape(substr($item["date"],8,2));?></div>
		<div class="ldc4_report"><?php echo $this->escape(substr($item["date"],11,2));?></div>
		<div class="ldc2_report"><a href="<?php echo $agent_link;?>"><?php echo $this->escape($item["agent_name"]);?></a></div>
		<div class="ldc5_report"><?php echo $this->escape($item["msisdn"]);?></div>
		<div class="ldc6_report"><?php echo $this->escape($item["short_code"]);?></div>
		<div class="ldc7_report"><?php echo $this->escape($item["mo_count"]);?></div>
		<div class="ldc8_report"><?php echo $this->escape($item["mt_count"]);?></div>
		<div class="ldc9_report"><?php echo $this->escape($item["cdr_count"]);?></div>
		<div class="ldc10_report"><?php echo $this->escape($item["money"]);?></div>
	</div>
	<?php endforeach;?>
</div>
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'paging/search.phtml', array("params" => $this->params)); ?>
<?php else: ?>
	<?php if($this->paginator != NULL): ?>
		<div class="list_report_message"><?php echo $this->translate("There is no transaction");?></div>
	<?php endif; ?>
<?php endif;?>